#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.

FROM mcr.microsoft.com/dotnet/aspnet:6.0-focal AS base

RUN sed -i '1iopenssl_conf = default_conf' /etc/ssl/openssl.cnf \
    && sed -i '$a[ default_conf ]\nssl_conf = ssl_sect\n \n[ ssl_sect ]\nsystem_default = system_default_sect\n \n[ system_default_sect ]\nMinProtocol = TLSv1\nCipherString = DEFAULT@SECLEVEL=1\n' /etc/ssl/openssl.cnf

WORKDIR /app
EXPOSE 80

FROM mcr.microsoft.com/dotnet/sdk:6.0 AS publish
WORKDIR /src
COPY . .
RUN dotnet publish "Host.csproj" -c Release -o /app/publish

#构建镜像
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "Host.dll"]